<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var arr = ['1', '2', '4', '5', '4'];
        console.log(arr.indexOf('2'));    //返回数组元素的索引号  1   顺序查找
        console.log(arr.indexOf('7'));    //找不到返回 -1
        console.log(arr.lastIndexOf('4'));  //从最后开始寻找，找到的第一个就直接返回
    </script>
</head>

<body>

</body>

</html>